#################################################
#	This file is program's makefile
#	You can use 'make' command to make this program.
#	Or you can use 'mak clean' to remove useless file.
#################################################

#cross_compile_tools
CC=gcc
#CC=arm-none-linux-gnueabi-gcc

#compile message
CFLAGS = -Wall -g -D_FILE_OFFSET_BITS=64

#include path
INCLUDE_PATH = -I./

#user application function
USER_APP_FUNC=ground_com_ctl

obj=main.o cJSON.o cJSON_Utils.o system_init.o global.o signal_process_func.o \
	dev_mmap_opt.o thread_one.o thread_two.o thread_three.o hitmc_sleep.o \
	hitmc_board.o fifo.o thread_four.o thread_five.o thread_eleven.o thread_twenty_one.o \
	hitmc_disk_space.o thread_twenty_two.o thread_twenty_three.o thread_twenty_four.o

$(USER_APP_FUNC):$(obj)
	$(CC) $(CFLAGS) $(INCLUDE_PATH) $(LIB_DIR) $(obj)  -lpthread -O2 -o $@

main.o:main.c  include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH)  -c main.c

cJSON.o:cJSON.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c cJSON.c

cJSON_Utils.o:cJSON_Utils.c  include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c cJSON_Utils.c

system_init.o:system_init.c  include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c system_init.c

signal_process_func.o:signal_process_func.c   include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c signal_process_func.c

dev_mmap_opt.o:dev_mmap_opt.c  include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c dev_mmap_opt.c

global.o:global.c  include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c global.c

hitmc_sleep.o:hitmc_sleep.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c hitmc_sleep.c

thread_one.o:thread_one.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_one.c

thread_two.o:thread_two.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_two.c

thread_three.o:thread_three.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_three.c

thread_four.o:thread_four.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_four.c

thread_five.o:thread_five.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_five.c

hitmc_board.o:hitmc_board.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c hitmc_board.c

fifo.o:fifo.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c fifo.c

hitmc_disk_space.o:hitmc_disk_space.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c hitmc_disk_space.c

thread_eleven.o:thread_eleven.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_eleven.c

thread_twenty_one.o:thread_twenty_one.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_twenty_one.c

thread_twenty_two.o:thread_twenty_two.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_twenty_two.c

thread_twenty_three.o:thread_twenty_three.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_twenty_three.c

thread_twenty_four.o:thread_twenty_four.c include.h
	$(CC) $(CFLAGS) $(INCLUDE_PATH) -c thread_twenty_four.c

.PHONY : clean
clean:
	rm -f $(USER_APP_FUNC) *.o
